//
//  VisitorViewController.swift
//  AAWeibo
//
//  Created by 上官风雨 on 15/11/11.
//  Copyright © 2015年 上官风雨. All rights reserved.
//

import UIKit

class BaseViewController: UITableViewController,VisitorLoginViewDelegate {
    //用户是否登录
    var userLogin :Bool = UserAccountViewModel().userLogin
    
    //访客模式
    var visitorLoginView : VisitorLoginView?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        userLogin ? super.loadView() : setupVisitorView()
    
    }
    
    func setupVisitorView(){
        visitorLoginView = VisitorLoginView()
        view = visitorLoginView
        visitorLoginView?.visitorDelegate = self
      self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "willLogin")
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "willRegister")
        
    }
    
    func willLogin(){
        
        print("将要登录")
        let vc = OauthViewController()
        let nav = UINavigationController(rootViewController: vc)
        
        presentViewController(nav, animated: true, completion: nil)
        
    }
    
    func willRegister(){
        
        print("将要注册")
        
    }


}
